/*	Nama file		: mCalender.cpp
	Deskripsi		: Driver untuk mengetes kelas Calender
	Nama pembuat	: Muhammad Ghufron Mahfudhi / 23512066
	Hari / Tanggal	: Kamis, 1 November 2012
*/

#include "Calendar.h"

int main(){
	/* Kamus Lokal */
	Calendar C;
	Event E1, E2, E3, E4, E5;
	/* Algoritma */
	/*
	cout << "\nMembuat 5 Event dengan nomor 21, 235, 12, 66, 1905\n";
	E1.BacaEvent(21);
	E2.BacaEvent(235);
	E3.BacaEvent(12);
	E4.BacaEvent(66);
	E5.BacaEvent(1905);
	
	cout << "\nMemasukkan 5 event ke dalam kalender\n";
	C.AddEvent(E1);
	C.AddEvent(E2);
	C.AddEvent(E3);
	C.AddEvent(E4);
	C.AddEvent(E5);
	*/
	string namafile = "coba.txt";
	
	// cout << "\nMenyimpan kalender ke dalam file \"coba.txt\"\n";
	// C.SaveFile(namafile);
	
	cout << "\nMembaca kalender dari file \"coba.txt\"\n";
	C.ReadFile(namafile);
	
	cout << "\nJumlah event dalam kalender: " << C.GetEventList().size() << endl << endl;
	
	if(C.GetEventList().size() > 0){
		for(list<Event>::reverse_iterator it = C.GetEventList().rbegin(); it!=C.GetEventList().rend(); it++){
			C.ViewEvent(it->GetNum());
		}
	}
	
	cout << "\nMenyortir dan menampilkan event dalam kalender\n";
	C.SortCal();
	if(C.GetEventList().size() > 0){
		for(list<Event>::reverse_iterator it = C.GetEventList().rbegin(); it!=C.GetEventList().rend(); it++){
			C.ViewEvent(it->GetNum());
		}
	}
	
	cout << "\nMenghapus Event dengan nomor 12\n";
	//cout << C.GetEventList().size()<<endl;
	C.DelEvent(12);
	//cout << C.GetEventList().size()<<endl;
	C.ViewCal();
	/*if(C.GetEventList().size() > 0){
		for(list<Event>::reverse_iterator it = C.GetEventList().rbegin(); it!=C.GetEventList().rend(); it++){
			C.ViewEvent(it->GetNum());
		}
	}*/
	
	
	
	return 0;
}
